TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file TeeBevel.php

Documentation is available at TeeBevel.php

  1. <?php
  2.  
  3. /**
  4.  * TeeBevel class
  5.  *
  6.  * Description: Displays bevels (frames) around rectangles
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @link http://www.steema.com
  13.  */
  14.  
  15. class TeeBevel extends TeeBase {
  16.  
  17.     protected $inner;
  18.     protected $outer;
  19.     public $defaultOuter;
  20.  
  21.     private $width = 1;
  22.     private $colorOne;
  23.     private $colorTwo;
  24.  
  25.     // Interceptors
  26.     function __get( $property ) {
  27.       $method ="get{$property}";
  28.       if ( method_exists( $this, $method ) ) {
  29.         return $this->$method();
  30.       }
  31.     }
  32.  
  33.     function __set ( $property,$value ) {
  34.       $method ="set{$property}";
  35.       if ( method_exists( $this, $method ) ) {
  36.         return $this->$method($value);
  37.       }
  38.     }
  39.  
  40.     public function TeeBevel($c) {
  41.         $this->inner=BevelStyle::$NONE;
  42.         $this->outer=BevelStyle::$NONE;
  43.  
  44.         $this->colorOne=new Color(255,255,255);
  45.         $this->colorTwo=new Color(180,180,180);
  46.  
  47.         parent::__construct($c);
  48.         $this->readResolve();
  49.     }
  50.  
  51.     protected function readResolve() {
  52.         $this->defaultOuter=BevelStyle::$NONE;
  53.         return $this;
  54.     }
  55.  
  56.     /**
  57.      * Defines the inner bevel type of the TChart Panel border. <br>
  58.      * Default value: BevelStyle.None
  59.      *
  60.      *
  61.      * @return BevelStyle 
  62.      */
  63.     public function getInner() {
  64.         return $this->inner;
  65.     }
  66.  
  67.     /**
  68.      * Defines the inner bevel type of the TChart Panel border. <br>
  69.      * Default value: BevelStyle.None
  70.      *
  71.      *
  72.      * @param value BevelStyle
  73.      */
  74.     public function setInner($value) {
  75.         if ($this->inner != $value) {
  76.             $this->inner = $value;
  77.             $this->invalidate();
  78.         }
  79.     }
  80.  
  81.     /**
  82.      * Width of the TeeChart Panel border in pixels. <br>
  83.      * Default value: 1
  84.      *
  85.      * @return int 
  86.      */
  87.     public function getWidth() {
  88.         return $this->width;
  89.     }
  90.  
  91.     /**
  92.      * Sets the width of the TeeChart Panel border in pixels. <br>
  93.      * Default value: 1
  94.      *
  95.      * @param value int
  96.      */
  97.     public function setWidth($value) {
  98.         $this->width = $this->setIntegerProperty($this->width, $value);
  99.     }
  100.  
  101.     /**
  102.      * Color of left and top sides of bevels. <br>Used together with ColorTwo
  103.      * to set the colors applied to the Bevel edge when Raised or Lowered. <br>
  104.      * Default value: white
  105.      *
  106.      * @return Color 
  107.      */
  108.     public function getColorOne() {
  109.         return $this->colorOne;
  110.     }
  111.  
  112.     /**
  113.      * Sets the Color of left and top sides of bevels. <br>
  114.      * Default value: white
  115.      *
  116.      * @param value Color
  117.      */
  118.     public function setColorOne($value) {
  119.         $this->colorOne = $this->setColorProperty($this->colorOne, $value);
  120.     }
  121.  
  122.     /**
  123.      * Color of right and bottom sides of bevels.<br> Used together with
  124.      * ColorOne, these properties set the colors applied to the Bevel edge
  125.      * when Raised or Lowered. <br>
  126.      * Default value: gray
  127.      *
  128.      * @return Color 
  129.      */
  130.     public function getColorTwo() {
  131.         return $this->colorTwo;
  132.     }
  133.  
  134.     /**
  135.      * Sets the Color of right and bottom sides of bevels.<br>
  136.      * Default value: gray
  137.      *
  138.      * @param value Color
  139.      */
  140.     public function setColorTwo($value) {
  141.         $this->colorTwo = $this->setColorProperty($this->colorTwo, $value);
  142.     }
  143.  
  144.     //private boolean shouldSerializeOuter() {
  145.     //    return outer != defaultOuter;
  146.     //}
  147.  
  148.     /**
  149.      * The outer bevel type of the TChart Panel border. <br>
  150.      *
  151.      *
  152.      * @return BevelStyle 
  153.      */
  154.     public function getOuter() {
  155.         return $this->outer;
  156.     }
  157.  
  158.     /**
  159.      * Defines the outer bevel type of the TChart Panel border. <br>
  160.      *
  161.      *
  162.      * @param value BevelStyle
  163.      */
  164.     public function setOuter($value) {
  165.         if ($this->outer != $value) {
  166.             $this->outer = $value;
  167.             $this->invalidate();
  168.         }
  169.     }
  170.  
  171.     /**
  172.      * Assigns all properties from one bevel to another.
  173.      *
  174.      * @param b Bevel
  175.      */
  176.     public function assign($b) {
  177.         if ($b != null) {
  178.             $this->colorOne = $b->colorOne;
  179.             $this->colorTwo = $b->colorTwo;
  180.             $this->inner = $b->inner;
  181.             $this->outer = $b->outer;
  182.             $this->width = $b->width;
  183.         }
  184.     }
  185.  
  186.     /**
  187.      * Draws bevels around rectangle parameter.
  188.      *
  189.      * @param g IGraphics3D
  190.      * @param rect Rectangle
  191.      */
  192.     public function draw($g, $rect) {
  193.         $r = new Rectangle($rect->x,$rect->y,$rect->width,$rect->height);
  194.  
  195.         if ($this->inner != BevelStyle::$NONE) {
  196.             $g->paintBevel($this->inner, $r, $this->width, $this->colorOne, $this->colorTwo);
  197.             $r->grow( -$this->width, -$this->width);
  198.         }
  199.  
  200.         if ($this->outer != BevelStyle::$NONE) {
  201.             $g->paintBevel($this->outer, $r, $this->width, $this->colorOne, $this->colorTwo);
  202.         }
  203.     }
  204. }
  205.  
  206. ?>

Documentation generated on Wed, 16 Jun 2010 12:08:35 +0200 by phpDocumentor 1.4.1